﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GriView隔行变色.aspx.cs" Inherits="GriView隔行变色" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>     
     <asp:GridView DataKeyNames="bookid" ID="GridView1" runat="server" AutoGenerateColumns="False" 
     OnRowDataBound="GridView1_RowDataBound"
     
DataSourceID="SqlConn"> 
<Columns>

<asp:BoundField DataField="bookid" HeaderText="bookid" />

<asp:BoundField DataField="qch" HeaderText="qch" />

<asp:TemplateField HeaderText="Select">

<ItemTemplate>

<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("bookid") %>' CommandName="Delete" runat="server">Delete</asp:LinkButton>

</ItemTemplate>

</asp:TemplateField>

</Columns>

</asp:GridView>

        &nbsp;<asp:SqlDataSource ID="SqlConn" runat="server" ConnectionString="<%$ ConnectionStrings:DB1 %>"
            SelectCommand="SELECT [bookid], [mch], [pp], [qch], [jj] FROM [book]"></asp:SqlDataSource>
        <br /><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DB1 %>"
            SelectCommand="SELECT * FROM [book]"></asp:SqlDataSource>
        <br />
        DataGrid 選擇確認對話框<br />
        <asp:DataGrid runat="server" ID="GridData" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Vertical"  ShowFooter="True" OnItemDataBound="changedd">
            <FooterStyle BackColor="#CCCC99" />
            <SelectedItemStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" Mode="NumericPages" />
            <AlternatingItemStyle BackColor="White" />
            <ItemStyle BackColor="#F7F7DE" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:TemplateColumn>
                    <ItemTemplate>
                        <asp:LinkButton ID="btdel" CommandName="Delete" runat="server">刪除</asp:LinkButton>
                    </ItemTemplate>
                
                </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>
    
    </div>
    </form>
</body>
</html>
